package sqs;

import org.apache.log4j.Logger;

import com.xerox.amazonws.sqs2.MessageQueue;
import com.xerox.amazonws.sqs2.SQSUtils;

public class EnqueMessage {
	 private static Logger log = Logger.getLogger(EnqueMessage.class);
	 final static String AWSAccessKeyId = "SOMETHING";
     final static  String SecretAccessKey = "SOMETHING";
     public static void main( String[] args ) {
             try {
                     if (args.length < 2) {
                             log.error("usage: EnqueueSample <queueId> <message>");
                     }
                     String queueName = "hum11queue";
                     String message = "ah ha the meesage is here";

                     // Create the message queue object
                     MessageQueue msgQueue = SQSUtils.connectToQueue(queueName, AWSAccessKeyId, SecretAccessKey);
                     log.info(" url returned = "+msgQueue.getUrl());

                     String msgId = msgQueue.sendMessage(message );
                     log.info( "Sent message with id " + msgId );
             } catch ( Exception ex ) {
                     log.error( "EXCEPTION", ex );
             }
     }
}
